import { required } from 'vee-validate/dist/rules'
import { extend } from 'vee-validate'
// 校验手机号码/必填项
// 手机号必填
extend('phoneRequired', {
  ...required,
  message: '请输入手机号',
})
// 手机号格式验证
const phoneReg = /^1[3-9][0-9]{9}$/
extend('phone', {
  ...required,
  validate(val) {
    return phoneReg.test(val)
  },
  message: '请输入正确的手机号',
})
// 密码必填
extend('passwordRequired', {
  ...required,
  message: '请输入密码',
})
//密码格式校验
const passwordReg = /^[a-zA-Z0-9_]{6,18}$/
extend('password', {
  validate(val) {
    return passwordReg.test(val)
  },
  message: '请按正确格式输入密码',
})

export { phoneReg }
